var e = require;
var t = module;
var o = exports;
var n;
Object.defineProperty(o, "__esModule", {value: !0}),
    (o.EShakeType = void 0),
    (function (e) {
        (e[(e.fromStrongToWeak = 1)] = "fromStrongToWeak"), (e[(e.Strong = 2)] = "Strong");
    })((n = o.EShakeType || (o.EShakeType = {})));
var a = (function () {
    function e() {}
    return (
        (e.setSpriteState = function (e, t) {
            void 0 === t && (t = !1), e && cc.isValid(e) && e._sgNode.setState(t ? 1 : 0);
        }),
        (e.shakeScreen = function (e, t, o, a, i) {
            void 0 === t && (t = cc.v2(15, 15)), void 0 === o && (o = 0.8), void 0 === a && (a = n.fromStrongToWeak);
            for (var r = [], s = 0; s < e.children.length; ++s) {
                var l = e.children[s];
                -1 == i.indexOf(l) && r.push({node: l, originPos: l.position});
            }
            function c(e, t) {
                for (var o = 0; o < r.length; ++o)
                    cc.isValid(r[o].node) && r[o].node.setPosition(r[o].originPos.x + e, r[o].originPos.y + t);
            }
            var d = 0,
                h = function (i) {
                    var r = (d += i) / o,
                        s = r;
                    r > 1 && (r = 1), a == n.fromStrongToWeak ? (s = 1 - r) : a == n.Strong && (s = 1);
                    var l = 2 * (Math.random() - 0.5) * t.x * s,
                        _ = 2 * (Math.random() - 0.5) * t.y * s;
                    1 == r ? (cc.director.getScheduler().unschedule(h, e), c(0, 0)) : cc.isValid(e) && c(l, _);
                };
            cc.director.getScheduler().schedule(h, e, 0);
        }),
        (e.scaleLoop = function (e, t, o, n, a, i) {
            var r = cc.repeatForever(
                    cc.sequence(
                        cc.scaleTo(n, t).easing(cc.easeOut(1)),
                        cc.scaleTo(n, 1).easing(cc.easeIn(1)),
                        cc.scaleTo(a, o).easing(cc.easeOut(1)),
                        cc.scaleTo(a, 1).easing(cc.easeIn(1))
                    )
                ),
                s = cc.sequence(
                    cc.delayTime(i),
                    cc.callFunc(function () {
                        e.stopAction(r), (e.scale = 1);
                    })
                );
            e.runAction(r), e.runAction(s);
        }),
        (e.playLabelRoll = function (e, t, o, n, a, i, r, s, l) {
            void 0 === l && (l = !1);
            var c = 0;
            if (!l) {
                var d = Math.ceil((i * a) / (n - o + 1));
                a = (d * (n - o + 1) + (t - o)) / i;
            }
            var h = function (l) {
                if ((c += l) >= a)
                    return (e.string = r ? r + t.toString() : t.toString()), this.unschedule(h), void s();
                var d = Math.floor(((i * c) % (n - o + 1)) + o);
                e.string = r ? r + d.toString() : d.toString();
            };
            e.schedule(h, 0);
        }),
        e
    );
})();
o.default = a;
